<template>
  <!-- 新增编辑 -->
  <a-modal
    width="95%"
    height="90%"
    :maskClosable="true"
    :visible="props.visible"
    :confirm-loading="loading"
    :forceRender="true"
    :title="props.data.diseaseName+'             患者：'+props.data.name"
    :body-style="{ paddingBottom: '8px', height: '520px', overflowY: 'auto' }"
    @update:visible="updateVisible"
  >
    <template #footer>
      <a-button @click="updateVisible(false)">关闭</a-button>
    </template>

    <a-col class="no-edit">
      <position-form v-model:form="form" ref="positionFormRef"></position-form>
    </a-col>
  </a-modal>
</template>

<script setup name="ReportView">
import { ref, onMounted } from 'vue';
import PositionForm from '../../patient/components/patient-form.vue';
import { getBusinessMaxSort } from '@/utils/common/util';

const props = defineProps({
  formList: [],
  visible: Boolean,
  data: Object
});

const emits = defineEmits(['update:visible', 'done']);
// 弹框加载
const loading = ref(false);
// 是否是编辑状态
const isUpdate = ref(false);
// 表单数据
const form = ref({});
const patient = ref({});
// ref
const positionFormRef = ref(null);
const diseaseList = ref([]);
onMounted(async() => {

  if (props.data) {
    isUpdate.value = true;

    patient.value = Object.assign({}, props.data);
    form.value = Object.assign({}, props.data);

  } else {
    form.value.positionSort = await getBusinessMaxSort('SYSTEM_HR_POSITION');
    isUpdate.value = false;
  }
});

// 更改弹框状态
const updateVisible = value => {
  emits('update:visible', value);
};

</script>

<style></style>
